package junior.db.dao.mybatis.base;

import junior.db.dao.mybatis.type.ResultType;
import junior.db.dao.query.AbstractQuery;
import junior.db.dao.query.QueryMapperProvider;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.SelectProvider;

import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * @author wubo
 * @date 2024/8/27 15:00
 */
public interface BaseSelectMapper<E> extends IBaseMapper<E> {
    
    @SelectProvider(type = QueryMapperProvider.class, method = "count")
    Long count(AbstractQuery query);
    
    @SelectProvider(type = QueryMapperProvider.class, method = "get")
    E get(AbstractQuery query);
    
    @SelectProvider(type = QueryMapperProvider.class, method = "getForObject")
    <T> T getForObject(@Param("query") AbstractQuery query, @Param("resultType") ResultType<T> resultType);
    
    @SelectProvider(type = QueryMapperProvider.class, method = "get")
    Map<String, Object> getForMap(AbstractQuery query);
    
    @SelectProvider(type = QueryMapperProvider.class, method = "get")
    String getForString(AbstractQuery query);
    
    @SelectProvider(type = QueryMapperProvider.class, method = "get")
    Integer getForInteger(AbstractQuery query);
    
    @SelectProvider(type = QueryMapperProvider.class, method = "get")
    Long getForLong(AbstractQuery query);
    
    @SelectProvider(type = QueryMapperProvider.class, method = "get")
    Boolean getForBoolean(AbstractQuery query);
    
    @SelectProvider(type = QueryMapperProvider.class, method = "get")
    BigDecimal getForBigDecimal(AbstractQuery query);
    
    @SelectProvider(type = QueryMapperProvider.class, method = "get")
    Date getForDate(AbstractQuery query);
    
    @SelectProvider(type = QueryMapperProvider.class, method = "get")
    LocalDate getForLocalDate(AbstractQuery query);
    
    @SelectProvider(type = QueryMapperProvider.class, method = "get")
    LocalDateTime getForLocalDateTime(AbstractQuery query);
    
    @SelectProvider(type = QueryMapperProvider.class, method = "get")
    List<E> list(AbstractQuery query);
    
    @SelectProvider(type = QueryMapperProvider.class, method = "getForObject")
    <T> List<T> listForObject(@Param("query") AbstractQuery query, @Param("resultType") ResultType<T> resultType);
    
    @SelectProvider(type = QueryMapperProvider.class, method = "get")
    List<Map<String, Object>> listForMap(AbstractQuery query);
    
    @SelectProvider(type = QueryMapperProvider.class, method = "get")
    List<String> listForString(AbstractQuery query);
    
    @SelectProvider(type = QueryMapperProvider.class, method = "get")
    List<Integer> listForInteger(AbstractQuery query);
    
    @SelectProvider(type = QueryMapperProvider.class, method = "get")
    List<Long> listForLong(AbstractQuery query);
    
    @SelectProvider(type = QueryMapperProvider.class, method = "get")
    List<Boolean> listForBoolean(AbstractQuery query);
    
    @SelectProvider(type = QueryMapperProvider.class, method = "get")
    List<BigDecimal> listForBigDecimal(AbstractQuery query);
    
    @SelectProvider(type = QueryMapperProvider.class, method = "get")
    List<Date> listForDate(AbstractQuery query);
    
    @SelectProvider(type = QueryMapperProvider.class, method = "get")
    List<LocalDate> listForLocalDate(AbstractQuery query);
    
    @SelectProvider(type = QueryMapperProvider.class, method = "get")
    List<LocalDateTime> listForLocalDateTime(AbstractQuery query);
}
